export default {
    state: {
        isCollapse: false,
        isPersionCollapse: false,
        menu: [],
        currentMenu: {},
        tabsList: [{
            path: "/",
            name: "home",
            label: "首页",
            icon: "home",
        }, ]
    },
    mutations: {
        selectMenu(state, val) {
            if (val.name !== 'home') {
                state.currentMenu = val;
                let result = state.tabsList.findIndex(item => item.name === val.name)
                result === -1 ? state.tabsList.push(val) : ''
            } else {
                state.currentMenu = {};
            }
            //val.name === 'home' ? (state.currentMenu = {}) : (state.currentMenu = val);
        },
        closeTab(state, val) {
            let result = state.tabsList.findIndex(item => item.name === val.name)
            state.tabsList.splice(result, 1)
        },
        collapseMenu(state) {
            state.isCollapse = !state.isCollapse
        },
        collapsePersionMenu(state) {
            state.isPersionCollapse = !state.isPersionCollapse
        }
    },
    actions: {},
}